/*
 * Copyright 2015-2016 Amazon.com, Inc. or its affiliates.  All Rights Reserved.
 *
 * You may not use this file except in compliance with the terms and conditions set forth
 * in the accompanying LICENSE.TXT file.
 *
 * THESE MATERIALS ARE PROVIDED ON AN "AS IS" BASIS.  AMAZON SPECIFICALLY DISCLAIMS, WITH
 * RESPECT TO THESE MATERIALS, ALL WARRANTIES, EXPRESS, IMPLIED, OR STATUTORY, INCLUDING
 * THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
 */

package com.amazon.alexa.voicechrome.internal.views;

import android.content.Context;
import android.util.AttributeSet;
import android.view.LayoutInflater;

import com.amazon.alexa.voicechrome.R;
import com.amazon.alexa.voicechrome.internal.views.util.wave.ThinkingProgressView;

/**
 * Visual implementation of the Thinking View
 */
public class ThinkingView extends ChromeTransitionView {

    private ThinkingProgressView thinkingProgressView;

    public ThinkingView(Context context) {
        super(context);
        init(context);
    }

    public ThinkingView(Context context, AttributeSet attrs) {
        super(context, attrs);
        init(context);
    }

    public ThinkingView(Context context, AttributeSet attrs, int defStyle) {
        super(context, attrs, defStyle);
        init(context);
    }

    private void init(Context context) {
        LayoutInflater.from(context).inflate(R.layout.voicechrome_thinking_view, this);
        thinkingProgressView = (ThinkingProgressView) findViewById(R.id.thinking_bar);
    }

    @Override
    public void resume() {
        super.resume();
        thinkingProgressView.start();
    }

    @Override
    public void pause() {
        super.pause();
        thinkingProgressView.stop();
    }

    @Override
    public void start() {
        super.start();
        thinkingProgressView.start();
    }

    @Override
    public void stop() {
        super.stop();
        thinkingProgressView.stop();
    }
}
